﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ReflectionStudio.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" >

    <!--ImageButton Style-->
    <Style x:Key="{x:Type local:ImageButton}" TargetType="{x:Type local:ImageButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ImageButton}">
                    <Button
                        Command="{Binding Command, RelativeSource={RelativeSource TemplatedParent}}"
                        CommandParameter="{Binding CommandParameter, RelativeSource={RelativeSource TemplatedParent}}"
                        HorizontalContentAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource TemplatedParent}}"
                        VerticalContentAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource TemplatedParent}}"
                        HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}"
                        VerticalAlignment="{Binding VerticalAlignment, RelativeSource={RelativeSource TemplatedParent}}">
                        <StackPanel Margin="12,2,2,2"
                            Orientation="{Binding (Layout), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ImageButton}}}"
                            HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

                            <Image Source="{Binding (Image), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ImageButton}}}"
                                Stretch="None" />

                            <TextBlock Text="{TemplateBinding Content}"
                                FontSize="{TemplateBinding FontSize}"
                                FontWeight="{TemplateBinding FontWeight}"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Margin="15,0" />
                        </StackPanel>
                    </Button>
                </ControlTemplate>
            </Setter.Value>
        </Setter>    
    </Style>
							
	<!--Flat Image Button Style-->
    <Style x:Key="{x:Type local:FlatImageButton}" TargetType="{x:Type local:FlatImageButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:FlatImageButton}">
                    <Border x:Name="content" CornerRadius="2" Padding="2" BorderThickness="1">
                        <local:AutoGreyableImage Source="{TemplateBinding Image}" Stretch="Fill" Margin="3"/>
                    </Border>
					<ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="content" Property="Background" Value="{DynamicResource HoverBackgroundBrush}"/>
                            <Setter TargetName="content" Property="BorderBrush" Value="{DynamicResource HoverBorderBrush}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="content" Property="Background" Value="{DynamicResource PressedBrush}"/>
							<Setter TargetName="content" Property="BorderBrush" Value="{DynamicResource DefaultBorderBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>    
    </Style>

    <!-- Style and Template for DropDownButton -->
    <Style TargetType="{x:Type local:DropDownButton}">
        <Setter Property="TextElement.Foreground" Value ="{DynamicResource NormalForegroundBrush}" />
        <Setter Property="Padding" Value="2,2,2,2"/>
        <Setter Property="Margin" Value="2,2,2,2"/>
        <Setter Property="Border.BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Panel.Background" Value="Transparent"/>
        <Setter Property="Border.BorderBrush" Value="Transparent"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DropDownButton}">
                    <Border
						BorderThickness="{TemplateBinding Border.BorderThickness}"
						Background="{TemplateBinding Panel.Background}"
                        CornerRadius="2" 
						x:Name="OuterBorder"
						SnapsToDevicePixels="True" >
                        <StackPanel Orientation="Horizontal">
                            <ContentPresenter
								Margin="{TemplateBinding Margin}"
								Content="{TemplateBinding Content}"
								ContentTemplate="{TemplateBinding ContentTemplate}"
								ContentStringFormat="{TemplateBinding ContentStringFormat}"
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            <Path Margin="6,2,2,2"
							      Data = "M0,0 L1,0 0.5,1 z"
							      Fill = "{TemplateBinding TextElement.Foreground}"
							      Width = "7"
							      Height = "3.5"
							      Stretch = "Fill"/>
                        </StackPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="OuterBorder" Value="{DynamicResource DefaultBorderBrush}" />
                            <Setter Property="Panel.Background" TargetName="OuterBorder" Value="{DynamicResource FlatButtonGradient}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter Property="BorderBrush" TargetName="OuterBorder" Value="{DynamicResource DefaultBorderBrush}"/>
                            <Setter Property="Panel.Background" TargetName="OuterBorder" Value="{DynamicResource FlatButtonGradient}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="TextElement.Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsDropDownMenuOpen" Value="True">
                            <Setter Property="BorderBrush" TargetName="OuterBorder" Value="{DynamicResource DefaultBorderBrush}" />
                            <Setter Property="BorderThickness" TargetName="OuterBorder" Value="1,1,1,0" />
                            <Setter Property="Panel.Background" TargetName="OuterBorder" Value="{DynamicResource DefaultBackgroundBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>